<?php
session_start();
require_once('config.php');
require_once('libs/router.php');

class LCms{
	public $cfg;
	public $router;
	public $ctl;

	public function __construct(){
		$this->cfg = new LConfig();
		$this->router = new LRouter('com_content','home',null);
	}

	public function execute(){
		if(!empty($_SESSION['login']) && !empty($_SESSION['access'])){
			$this->router->dispatch();
		} else {
			$this->router = new LRouter('com_user','login',null);
		}
		require_once 'components/'.$this->router->com.'/controller.php';
		$this->ctl = new LController($this->cfg,$this->router->com,$this->router->view,$this->router->id);
		$this->ctl->display();
	}
}